package com.adinnet.common.biz.enums;

/**
 *
 */
public enum RoleCode {
    ADMIN("admin", "主校区管理员"),
    SCHOOL("school", "校区管理员"),
    CLASSS("classs", "班级负责人"),
    ORGANIZATION("organization", "机构");

    private String code;
    private String name;

    RoleCode(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 根据code获取name
     * @param code
     * @return
     */
    public static String getNameByCode(String code){
        for(RoleCode validType: RoleCode.values()){
            if(code.equals(validType.getCode())){
                return validType.getName();
            }
        }
        return  null;
    }

}
